<%@ include file="/html/portlet/ext/dashBoard/init.jsp" %>

<b><liferay-ui:message key="mainstay_user_list" /> &raquo;</b><br><br>

<%  
	PortletURL navigationURL = renderResponse.createRenderURL();
	navigationURL.setParameter("struts_action", "/ext/dashBoard/dashBoardAction");
	navigationURL.setParameter(Constants.CMD, "mainsayList-nav"); 
		
	List<Mainstay> mainstayList = null;
	
	if(!permissionChecker.isOmniadmin()) {
	
		Long userId = themeDisplay.getUserId();
		mainstayList = MainstayLocalServiceUtil.getByUserId(userId);
		
	} else {
	
		mainstayList = MainstayLocalServiceUtil.getByStatus(1); 
	}
		
   	SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, 5, navigationURL, null, "");
	List<Mainstay> result = ListUtil.subList(mainstayList, searchContainer.getStart(), searchContainer.getEnd());
	int total = mainstayList.size();
	searchContainer.setTotal(total);	
		
   	for(int i=0; i < result.size(); i++) {
		Mainstay mainstay = result.get(i);
%>
	<liferay-ui:user-display userId="<%= mainstay.getUserId() %>" userName="<%= mainstay.getFirstName() %>" displayStyle="2"/> 		
<%}%>

	<div class="taglib-search-iterator-page-iterator-bottom">
			<liferay-ui:search-paginator searchContainer="<%= searchContainer %>" />
	</div>

	<br>&laquo;<a href="javascript:history.go(-1)()"><liferay-ui:message key="back" /></a></b>